package com.yilizhiyou.model;

import com.yilizhiyou.entity.ScenicSpot;
import java.util.List;
import java.util.Map;

/**
 * 推荐结果模型
 * 包含推荐的行程和相关信息
 * 
 * @author 伊犁智游开发团队
 * @since 1.0.0
 */
public class RecommendationResult {
    
    // 推荐ID
    private String recommendationId;
    
    // 推荐标题
    private String title;
    
    // 推荐描述
    private String description;
    
    // 推荐景点列表
    private List<ScenicSpot> recommendedSpots;
    
    // 推荐天数
    private Integer duration;
    
    // 预估总费用
    private Double estimatedCost;
    
    // 推荐分数 (0-100)
    private Double score;
    
    // 推荐理由
    private String reason;
    
    // 适合的天气条件
    private List<String> suitableWeather;
    
    // 交通方式建议
    private String transportSuggestion;
    
    // 最佳游览时间
    private String bestTime;
    
    // 推荐算法类型
    private String algorithmType;
    
    // 个性化匹配度
    private Double personalizationScore;
    
    // 景点类型分布
    private Map<String, Integer> typeDistribution;
    
    // 难度等级 (1-5)
    private Integer difficultyLevel;
    
    // 文化指数 (1-5)
    private Integer culturalIndex;
    
    // 自然指数 (1-5)
    private Integer natureIndex;
    
    // 历史指数 (1-5)
    private Integer historicalIndex;
    
    // 美食指数 (1-5)
    private Integer foodIndex;
    
    // 摄影指数 (1-5)
    private Integer photographyIndex;
    
    public RecommendationResult() {}
    
    public RecommendationResult(String recommendationId, String title, List<ScenicSpot> recommendedSpots) {
        this.recommendationId = recommendationId;
        this.title = title;
        this.recommendedSpots = recommendedSpots;
        this.duration = recommendedSpots != null ? recommendedSpots.size() : 0;
    }
    
    // Getters and Setters
    public String getRecommendationId() {
        return recommendationId;
    }
    
    public void setRecommendationId(String recommendationId) {
        this.recommendationId = recommendationId;
    }
    
    public String getTitle() {
        return title;
    }
    
    public void setTitle(String title) {
        this.title = title;
    }
    
    public String getDescription() {
        return description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }
    
    public List<ScenicSpot> getRecommendedSpots() {
        return recommendedSpots;
    }
    
    public void setRecommendedSpots(List<ScenicSpot> recommendedSpots) {
        this.recommendedSpots = recommendedSpots;
        this.duration = recommendedSpots != null ? recommendedSpots.size() : 0;
    }
    
    public Integer getDuration() {
        return duration;
    }
    
    public void setDuration(Integer duration) {
        this.duration = duration;
    }
    
    public Double getEstimatedCost() {
        return estimatedCost;
    }
    
    public void setEstimatedCost(Double estimatedCost) {
        this.estimatedCost = estimatedCost;
    }
    
    public Double getScore() {
        return score;
    }
    
    public void setScore(Double score) {
        this.score = score;
    }
    
    public String getReason() {
        return reason;
    }
    
    public void setReason(String reason) {
        this.reason = reason;
    }
    
    public List<String> getSuitableWeather() {
        return suitableWeather;
    }
    
    public void setSuitableWeather(List<String> suitableWeather) {
        this.suitableWeather = suitableWeather;
    }
    
    public String getTransportSuggestion() {
        return transportSuggestion;
    }
    
    public void setTransportSuggestion(String transportSuggestion) {
        this.transportSuggestion = transportSuggestion;
    }
    
    public String getBestTime() {
        return bestTime;
    }
    
    public void setBestTime(String bestTime) {
        this.bestTime = bestTime;
    }
    
    public String getAlgorithmType() {
        return algorithmType;
    }
    
    public void setAlgorithmType(String algorithmType) {
        this.algorithmType = algorithmType;
    }
    
    public Double getPersonalizationScore() {
        return personalizationScore;
    }
    
    public void setPersonalizationScore(Double personalizationScore) {
        this.personalizationScore = personalizationScore;
    }
    
    public Map<String, Integer> getTypeDistribution() {
        return typeDistribution;
    }
    
    public void setTypeDistribution(Map<String, Integer> typeDistribution) {
        this.typeDistribution = typeDistribution;
    }
    
    public Integer getDifficultyLevel() {
        return difficultyLevel;
    }
    
    public void setDifficultyLevel(Integer difficultyLevel) {
        this.difficultyLevel = difficultyLevel;
    }
    
    public Integer getCulturalIndex() {
        return culturalIndex;
    }
    
    public void setCulturalIndex(Integer culturalIndex) {
        this.culturalIndex = culturalIndex;
    }
    
    public Integer getNatureIndex() {
        return natureIndex;
    }
    
    public void setNatureIndex(Integer natureIndex) {
        this.natureIndex = natureIndex;
    }
    
    public Integer getHistoricalIndex() {
        return historicalIndex;
    }
    
    public void setHistoricalIndex(Integer historicalIndex) {
        this.historicalIndex = historicalIndex;
    }
    
    public Integer getFoodIndex() {
        return foodIndex;
    }
    
    public void setFoodIndex(Integer foodIndex) {
        this.foodIndex = foodIndex;
    }
    
    public Integer getPhotographyIndex() {
        return photographyIndex;
    }
    
    public void setPhotographyIndex(Integer photographyIndex) {
        this.photographyIndex = photographyIndex;
    }
    
    /**
     * 计算推荐结果的总分
     */
    public void calculateTotalScore() {
        if (this.score == null) {
            this.score = 0.0;
        }
        
        // 基础分数
        double baseScore = this.score;
        
        // 个性化匹配度加分
        if (this.personalizationScore != null) {
            baseScore += this.personalizationScore * 0.3;
        }
        
        // 景点数量加分
        if (this.recommendedSpots != null && !this.recommendedSpots.isEmpty()) {
            baseScore += Math.min(this.recommendedSpots.size() * 5, 20);
        }
        
        // 确保分数在0-100范围内
        this.score = Math.max(0, Math.min(100, baseScore));
    }
}
